package choice_test;

import java.util.Scanner;

public class java_chapter3_exercise_6 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("please input the first number:");
		int num1 = in.nextInt();
		System.out.println("please input the operand:");
		char operand =in.next().charAt(0);
		System.out.println("please input the second number:");
		int num2 = in.nextInt();
		int result = 0;
		switch(operand) {
		case '+':
			result=num1+num2;
			break;
		case '-':
			result=num1-num2;
			break;
		case '*':
			result=num1*num2;
			break;
		case '/':
		{
			if (num2==0) {
				System.out.println("dividend cannnot be 0!");
				return;
			}
			else {
				result = num1/num2;
			}
			break;
		}
		case '%':
		{
			if (num1%num2==0) {
				return;
			}
			else {
				result = num1%num2;
			}
			break;
		}
		default：
			System.out.println("please input a valid operand");
			
		}
		
		System.out.println("result is:"+result);
		

	}

}
